Range

Ecng.ComponentModel

Represents a generic range defined by a minimum and maximum value.

Erbt von: Equatable<Range<T>>

Implementiert: IConvertible, IRange<T>, IRange, ICloneable

Konstruktoren

Range
private Range()
range = Range()

Initializes static members of the Range class.

Range
public Range()
range = Range()

Initializes a new instance of the Range class.

Range
public Range(T min, T max)
range = Range(min, max)

Initializes a new instance of the Range class with specified minimum and maximum values.

min
The minimum value of the range.
max
The maximum value of the range.

Eigenschaften

HasMaxValue
public bool HasMaxValue { get; }
value = range.HasMaxValue

Gets a value indicating whether the range has a specified maximum value.

HasMinValue
public bool HasMinValue { get; }
value = range.HasMinValue

Gets a value indicating whether the range has a specified minimum value.

Length
public T Length { get; }
value = range.Length

Gets the difference between the maximum and minimum values of the range.

Max
public T Max { get; set; }
value = range.Max
range.Max = value

Gets or sets the maximum value of the range.

Min
public T Min { get; set; }
value = range.Min
range.Min = value

Gets or sets the minimum value of the range.

Operator
public IOperator<T> Operator { get; set; }
value = range.Operator
range.Operator = value

Gets or sets the operator used for arithmetic operations within the range.

Methoden

Clone
public override Range<T> Clone()
result = range.Clone()

Creates a new object that is a copy of the current instance.

Rückgabe: A new object that is a copy of this instance.

Contains
public bool Contains(IRange<T> range)
result = range.Contains(range)

Determines whether the current range completely contains another range.

range
The range to check against.

Rückgabe: true if the range is contained; otherwise, false.

Contains
public bool Contains(T value)
result = range.Contains(value)

Determines whether the specified value is within the current range.

value
The value to test.

Rückgabe: true if the value is within the range; otherwise, false.

GetHashCode
public override int GetHashCode()
result = range.GetHashCode()

Serves as the default hash function.

Rückgabe: A hash code for the current object.

Init
private void Init(T min, T max)
range.Init(min, max)

Initializes the range with the specified minimum and maximum values.

min
The minimum value.
max
The maximum value.
Intersect
public IRange<T> Intersect(IRange<T> range)
result = range.Intersect(range)

Returns the intersection of the current range with another range.

range
The range with which to intersect.

Rückgabe: A new IRange representing the overlap between the two ranges, or null if there is no intersection.

OnEquals
protected override bool OnEquals(Range<T> other)
result = range.OnEquals(other)
SubRange
public Range<T> SubRange(T min, T max)
result = range.SubRange(min, max)

Creates a sub-range from the current range given the specified minimum and maximum values.

min
The minimum value of the sub-range.
max
The maximum value of the sub-range.

Rückgabe: A new Range representing the sub-range.

ToString
public override string ToString()
result = range.ToString()

Returns a string representation of the tuple, with values separated by commas.

Rückgabe: A string representing the tuple's values.